<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The DOMDocument class</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="domcomment.construct.html">DOMComment::__construct</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="domdocument.construct.html">DOMDocument::__construct</a></div>
 <div class="up"><a href="book.dom.html">DOM</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.domdocument" class="reference">
 <h1 class="title">The DOMDocument class</h1>
 
 
 <div class="partintro"><p class="verinfo">(PHP 4 &gt;= 4.1.0)</p>
 

  <div class="section" id="domdocument.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    Represents an entire HTML or XML document; serves as the root of the
    document tree.
   </p>
  </div>

 
  <div class="section" id="domdocument.synopsis">
   <h2 class="title">类摘要</h2>
 

   <div class="classsynopsis">
    <div class="ooclass"></div>
 

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <strong class="classname">DOMDocument</strong>
     </span>
 

     <span class="ooclass">
      <span class="modifier">extends</span>
      <a href="class.domnode.html" class="classname">DOMNode</a>
     </span>
 
     {</div>

 
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 属性 */</div>

    <div class="fieldsynopsis">
     <span class="modifier">readonly</span>
     <span class="modifier">public</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.actualencoding">$<var class="varname">actualEncoding</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">readonly</span>
     <span class="modifier">public</span>
     <span class="type"><span class="type DOMConfiguration">DOMConfiguration</span></span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.config">$<var class="varname">config</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">readonly</span>
     <span class="modifier">public</span>
     <span class="type"><a href="class.domdocumenttype.html" class="type DOMDocumentType">DOMDocumentType</a></span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.doctype">$<var class="varname">doctype</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">readonly</span>
     <span class="modifier">public</span>
     <span class="type"><a href="class.domelement.html" class="type DOMElement">DOMElement</a></span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.documentelement">$<var class="varname">documentElement</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.documenturi">$<var class="varname">documentURI</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.encoding">$<var class="varname">encoding</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">bool</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.formatoutput">$<var class="varname">formatOutput</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">readonly</span>
     <span class="modifier">public</span>
     <span class="type"><a href="class.domimplementation.html" class="type DOMImplementation">DOMImplementation</a></span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.implementation">$<var class="varname">implementation</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">bool</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.preservewhitespace">$<var class="varname">preserveWhiteSpace</var></a></var>
     <span class="initializer"> = true</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">bool</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.recover">$<var class="varname">recover</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">bool</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.resolveexternals">$<var class="varname">resolveExternals</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">bool</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.standalone">$<var class="varname">standalone</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">bool</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.stricterrorchecking">$<var class="varname">strictErrorChecking</var></a></var>
     <span class="initializer"> = true</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">bool</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.substituteentities">$<var class="varname">substituteEntities</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">bool</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.validateonparse">$<var class="varname">validateOnParse</var></a></var>
     <span class="initializer"> = false</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.version">$<var class="varname">version</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">readonly</span>
     <span class="modifier">public</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.xmlencoding">$<var class="varname">xmlEncoding</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">bool</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.xmlstandalone">$<var class="varname">xmlStandalone</var></a></var>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">public</span>
     <span class="type">string</span>
      <var class="varname"><a href="class.domdocument.html#domdocument.props.xmlversion">$<var class="varname">xmlVersion</var></a></var>
    ;</div>

 
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="domdocument.construct.html" class="methodname">__construct</a></span>
    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$version</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$encoding</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMAttr</span><span class="methodname"><a href="domdocument.createattribute.html" class="methodname">createAttribute</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMAttr</span><span class="methodname"><a href="domdocument.createattributens.html" class="methodname">createAttributeNS</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$namespaceURI</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$qualifiedName</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMCDATASection</span><span class="methodname"><a href="domdocument.createcdatasection.html" class="methodname">createCDATASection</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMComment</span><span class="methodname"><a href="domdocument.createcomment.html" class="methodname">createComment</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMDocumentFragment</span><span class="methodname"><a href="domdocument.createdocumentfragment.html" class="methodname">createDocumentFragment</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMElement</span><span class="methodname"><a href="domdocument.createelement.html" class="methodname">createElement</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$value</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMElement</span><span class="methodname"><a href="domdocument.createelementns.html" class="methodname">createElementNS</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$namespaceURI</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$qualifiedName</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$value</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMEntityReference</span><span class="methodname"><a href="domdocument.createentityreference.html" class="methodname">createEntityReference</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMProcessingInstruction</span><span class="methodname"><a href="domdocument.createprocessinginstruction.html" class="methodname">createProcessingInstruction</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$target</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMText</span><span class="methodname"><a href="domdocument.createtextnode.html" class="methodname">createTextNode</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$content</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMElement</span><span class="methodname"><a href="domdocument.getelementbyid.html" class="methodname">getElementById</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$elementId</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNodeList</span><span class="methodname"><a href="domdocument.getelementsbytagname.html" class="methodname">getElementsByTagName</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNodeList</span><span class="methodname"><a href="domdocument.getelementsbytagnamens.html" class="methodname">getElementsByTagNameNS</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$namespaceURI</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$localName</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNode</span><span class="methodname"><a href="domdocument.importnode.html" class="methodname">importNode</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$importedNode</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$deep</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">mixed</span><span class="methodname"><a href="domdocument.load.html" class="methodname">load</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domdocument.loadhtml.html" class="methodname">loadHTML</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$source</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domdocument.loadhtmlfile.html" class="methodname">loadHTMLFile</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">mixed</span><span class="methodname"><a href="domdocument.loadxml.html" class="methodname">loadXML</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$source</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="domdocument.normalizedocument.html" class="methodname">normalizeDocument</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domdocument.registernodeclass.html" class="methodname">registerNodeClass</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$baseclass</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$extendedclass</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domdocument.relaxngvalidate.html" class="methodname">relaxNGValidate</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domdocument.relaxngvalidatesource.html" class="methodname">relaxNGValidateSource</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$source</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="domdocument.save.html" class="methodname">save</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="domdocument.savehtml.html" class="methodname">saveHTML</a></span>
    ([ <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$node</code><span class="initializer"> = NULL</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="domdocument.savehtmlfile.html" class="methodname">saveHTMLFile</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
  )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="domdocument.savexml.html" class="methodname">saveXML</a></span>
    ([ <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$node</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code></span>
  ]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domdocument.schemavalidate.html" class="methodname">schemaValidate</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domdocument.schemavalidatesource.html" class="methodname">schemaValidateSource</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$source</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domdocument.validate.html" class="methodname">validate</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="domdocument.xinclude.html" class="methodname">xinclude</a></span>
    ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code></span>
  ] )</div>

 

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 继承的方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNode</span><span class="methodname"><a href="domnode.appendchild.html" class="methodname">DOMNode::appendChild</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$newnode</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="domnode.c14n.html" class="methodname">DOMNode::C14N</a></span>
    ([ <span class="methodparam"><span class="type">bool</span> <code class="parameter">$exclusive</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$with_comments</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$xpath</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$ns_prefixes</code></span>
  ]]]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="domnode.c14nfile.html" class="methodname">DOMNode::C14NFile</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$uri</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$exclusive</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$with_comments</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$xpath</code></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$ns_prefixes</code></span>
  ]]]] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNode</span><span class="methodname"><a href="domnode.clonenode.html" class="methodname">DOMNode::cloneNode</a></span>
    ([ <span class="methodparam"><span class="type">bool</span> <code class="parameter">$deep</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="domnode.getlineno.html" class="methodname">DOMNode::getLineNo</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="domnode.getnodepath.html" class="methodname">DOMNode::getNodePath</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domnode.hasattributes.html" class="methodname">DOMNode::hasAttributes</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domnode.haschildnodes.html" class="methodname">DOMNode::hasChildNodes</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNode</span><span class="methodname"><a href="domnode.insertbefore.html" class="methodname">DOMNode::insertBefore</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$newnode</code></span>
   [, <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$refnode</code></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domnode.isdefaultnamespace.html" class="methodname">DOMNode::isDefaultNamespace</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$namespaceURI</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domnode.issamenode.html" class="methodname">DOMNode::isSameNode</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$node</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="domnode.issupported.html" class="methodname">DOMNode::isSupported</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$feature</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$version</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="domnode.lookupnamespaceuri.html" class="methodname">DOMNode::lookupNamespaceURI</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$prefix</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="domnode.lookupprefix.html" class="methodname">DOMNode::lookupPrefix</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$namespaceURI</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="domnode.normalize.html" class="methodname">DOMNode::normalize</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNode</span><span class="methodname"><a href="domnode.removechild.html" class="methodname">DOMNode::removeChild</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$oldnode</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DOMNode</span><span class="methodname"><a href="domnode.replacechild.html" class="methodname">DOMNode::replaceChild</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$newnode</code></span>
   , <span class="methodparam"><span class="type"><a href="class.domnode.html" class="type DOMNode">DOMNode</a></span> <code class="parameter">$oldnode</code></span>
   )</div>


   }</div>

 
  </div>
 

  <div class="section" id="domdocument.props">
   <h2 class="title">属性</h2>
   <dl>

    
     <dt id="domdocument.props.actualencoding"><var class="varname"><var class="varname">actualEncoding</var></var></dt>

     <dd>

      <p class="para">
       <em class="emphasis">Deprecated</em>. Actual encoding of the document,
       is a readonly equivalent to
       <var class="varname"><var class="varname">encoding</var></var>.
      </p>
     </dd>

    
    
     <dt id="domdocument.props.config"><var class="varname"><var class="varname">config</var></var></dt>

     <dd>

      <p class="para">
       <em class="emphasis">Deprecated</em>. Configuration used when
       <span class="function"><a href="domdocument.normalizedocument.html" class="function">DOMDocument::normalizeDocument()</a></span> is
       invoked.
      </p>
     </dd>

    
    
     <dt id="domdocument.props.doctype"><var class="varname"><var class="varname">doctype</var></var></dt>

     <dd>

      <p class="para">The Document Type Declaration associated with this document.</p>
     </dd>

    
    
     <dt id="domdocument.props.documentelement"><var class="varname"><var class="varname">documentElement</var></var></dt>

     <dd>

      <p class="para">
       This is a convenience attribute that allows direct access to the
       child node that is the document element of the document.
      </p>
     </dd>

    
    
     <dt id="domdocument.props.documenturi"><var class="varname"><var class="varname">documentURI</var></var></dt>

     <dd>

      <p class="para">The location of the document or <strong><code>NULL</code></strong> if undefined.</p>
     </dd>

    
    
     <dt id="domdocument.props.encoding"><var class="varname"><var class="varname">encoding</var></var></dt>

     <dd>

      <p class="para">
       Encoding of the document, as specified by the XML declaration. This
       attribute is not present in the final DOM Level 3 specification, but
       is the only way of manipulating XML document encoding in this
       implementation.
      </p>
     </dd>

    
    
     <dt id="domdocument.props.formatoutput"><var class="varname"><var class="varname">formatOutput</var></var></dt>

     <dd>

      <p class="para">Nicely formats output with indentation and extra space.</p>
     </dd>

    
    
     <dt id="domdocument.props.implementation"><var class="varname"><var class="varname">implementation</var></var></dt>

     <dd>

      <p class="para">
       The <a href="class.domimplementation.html" class="classname">DOMImplementation</a> object that handles 
       this document.
      </p>
     </dd>

    
    
     <dt id="domdocument.props.preservewhitespace"><var class="varname"><var class="varname">preserveWhiteSpace</var></var></dt>

     <dd>

      <p class="para">Do not remove redundant white space. Default to <strong><code>TRUE</code></strong>.</p>
     </dd>

    
    
     <dt id="domdocument.props.recover"><var class="varname"><var class="varname">recover</var></var></dt>

     <dd>

      <p class="para">
       <em class="emphasis">Proprietary</em>. Enables recovery mode, i.e. trying
       to parse non-well formed documents. This attribute is not part of
       the DOM specification and is specific to libxml.
      </p>
     </dd>

    
    
     <dt id="domdocument.props.resolveexternals"><var class="varname"><var class="varname">resolveExternals</var></var></dt>

     <dd>

      <p class="para">
       Set it to <strong><code>TRUE</code></strong> to load external entities from a doctype 
       declaration. This is useful for including character entities in
       your XML document.
      </p>
     </dd>

    
    
     <dt id="domdocument.props.standalone"><var class="varname"><var class="varname">standalone</var></var></dt>

     <dd>

      <p class="para">
       <em class="emphasis">Deprecated</em>. Whether or not the document is
       standalone, as specified by the XML declaration, corresponds to
       <var class="varname"><var class="varname">xmlStandalone</var></var>.
      </p>
     </dd>

    
    
     <dt id="domdocument.props.stricterrorchecking"><var class="varname"><var class="varname">strictErrorChecking</var></var></dt>

     <dd>

      <p class="para">Throws <a href="class.domexception.html" class="classname">DOMException</a> on errors. Default to <strong><code>TRUE</code></strong>.</p>
     </dd>

    
    
     <dt id="domdocument.props.substituteentities"><var class="varname"><var class="varname">substituteEntities</var></var></dt>

     <dd>

      <p class="para">
       <em class="emphasis">Proprietary</em>. Whether or not to substitute
       entities. This attribute is not part of
       the DOM specification and is specific to libxml.
      </p>
     </dd>

    
    
     <dt id="domdocument.props.validateonparse"><var class="varname"><var class="varname">validateOnParse</var></var></dt>

     <dd>

      <p class="para">Loads and validates against the DTD. Default to <strong><code>FALSE</code></strong>.</p>
     </dd>

    
    
     <dt id="domdocument.props.version"><var class="varname"><var class="varname">version</var></var></dt>

     <dd>

      <p class="para">
       <em class="emphasis">Deprecated</em>. Version of XML, corresponds to
       <var class="varname"><var class="varname">xmlVersion</var></var>.
      </p>
     </dd>

    
    
     <dt id="domdocument.props.xmlencoding"><var class="varname"><var class="varname">xmlEncoding</var></var></dt>

     <dd>

      <p class="para">
       An attribute specifying, as part of the XML declaration, the
       encoding of this document. This is <strong><code>NULL</code></strong> when unspecified or when it
       is not known, such as when the Document was created in memory.
      </p>
     </dd>

    
    
     <dt id="domdocument.props.xmlstandalone"><var class="varname"><var class="varname">xmlStandalone</var></var></dt>

     <dd>

      <p class="para">
       An attribute specifying, as part of the XML declaration, whether
       this document is standalone. This is <strong><code>FALSE</code></strong> when unspecified.
      </p>
     </dd>

    
    
     <dt id="domdocument.props.xmlversion"><var class="varname"><var class="varname">xmlVersion</var></var></dt>

     <dd>

      <p class="para">
       An attribute specifying, as part of the XML declaration, the
       version number of this document. If there is no declaration and if
       this document supports the &quot;XML&quot; feature, the value is &quot;1.0&quot;.
      </p>
     </dd>

    
   </dl>

  </div>



  <div class="section">
   <h2 class="title">注释</h2>
   <blockquote class="note"><p><strong class="note">Note</strong>: 
    <p class="para">
     The DOM extension uses UTF-8 encoding. Use <span class="function"><a href="function.utf8-encode.html" class="function">utf8_encode()</a></span>
     and <span class="function"><a href="function.utf8-decode.html" class="function">utf8_decode()</a></span> to work with texts in ISO-8859-1
     encoding or <a href="ref.iconv.html" class="link">Iconv</a> for other encodings.
    </p>
   </p></blockquote>
  </div>

  

  <div class="section">
   <h2 class="title">参见</h2>
   <p class="para">
    <ul class="simplelist">
     <li class="member"><a href="http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-i-Document" class="link external">&raquo;&nbsp;W3C specification for Document</a></li>
    </ul>
   </p>
  </div>

 
 </div>
 
 


























































































































































































 
<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="domdocument.construct.html">DOMDocument::__construct</a> — Creates a new DOMDocument object</li><li><a href="domdocument.createattribute.html">DOMDocument::createAttribute</a> — Create new attribute</li><li><a href="domdocument.createattributens.html">DOMDocument::createAttributeNS</a> — Create new attribute node with an associated namespace</li><li><a href="domdocument.createcdatasection.html">DOMDocument::createCDATASection</a> — Create new cdata node</li><li><a href="domdocument.createcomment.html">DOMDocument::createComment</a> — Create new comment node</li><li><a href="domdocument.createdocumentfragment.html">DOMDocument::createDocumentFragment</a> — Create new document fragment</li><li><a href="domdocument.createelement.html">DOMDocument::createElement</a> — Create new element node</li><li><a href="domdocument.createelementns.html">DOMDocument::createElementNS</a> — Create new element node with an associated namespace</li><li><a href="domdocument.createentityreference.html">DOMDocument::createEntityReference</a> — Create new entity reference node</li><li><a href="domdocument.createprocessinginstruction.html">DOMDocument::createProcessingInstruction</a> — Creates new PI node</li><li><a href="domdocument.createtextnode.html">DOMDocument::createTextNode</a> — Create new text node</li><li><a href="domdocument.getelementbyid.html">DOMDocument::getElementById</a> — Searches for an element with a certain id</li><li><a href="domdocument.getelementsbytagname.html">DOMDocument::getElementsByTagName</a> — Searches for all elements with given local tag name</li><li><a href="domdocument.getelementsbytagnamens.html">DOMDocument::getElementsByTagNameNS</a> — Searches for all elements with given tag name in specified namespace</li><li><a href="domdocument.importnode.html">DOMDocument::importNode</a> — Import node into current document</li><li><a href="domdocument.load.html">DOMDocument::load</a> — Load XML from a file</li><li><a href="domdocument.loadhtml.html">DOMDocument::loadHTML</a> — Load HTML from a string</li><li><a href="domdocument.loadhtmlfile.html">DOMDocument::loadHTMLFile</a> — Load HTML from a file</li><li><a href="domdocument.loadxml.html">DOMDocument::loadXML</a> — Load XML from a string</li><li><a href="domdocument.normalizedocument.html">DOMDocument::normalizeDocument</a> — Normalizes the document</li><li><a href="domdocument.registernodeclass.html">DOMDocument::registerNodeClass</a> — Register extended class used to create base node type</li><li><a href="domdocument.relaxngvalidate.html">DOMDocument::relaxNGValidate</a> — Performs relaxNG validation on the document</li><li><a href="domdocument.relaxngvalidatesource.html">DOMDocument::relaxNGValidateSource</a> — Performs relaxNG validation on the document</li><li><a href="domdocument.save.html">DOMDocument::save</a> — Dumps the internal XML tree back into a file</li><li><a href="domdocument.savehtml.html">DOMDocument::saveHTML</a> — Dumps the internal document into a string using HTML formatting</li><li><a href="domdocument.savehtmlfile.html">DOMDocument::saveHTMLFile</a> — Dumps the internal document into a file using HTML formatting</li><li><a href="domdocument.savexml.html">DOMDocument::saveXML</a> — Dumps the internal XML tree back into a string</li><li><a href="domdocument.schemavalidate.html">DOMDocument::schemaValidate</a> — Validates a document based on a schema</li><li><a href="domdocument.schemavalidatesource.html">DOMDocument::schemaValidateSource</a> — Validates a document based on a schema</li><li><a href="domdocument.validate.html">DOMDocument::validate</a> — Validates the document based on its DTD</li><li><a href="domdocument.xinclude.html">DOMDocument::xinclude</a> — Substitutes XIncludes in a DOMDocument Object</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="domcomment.construct.html">DOMComment::__construct</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="domdocument.construct.html">DOMDocument::__construct</a></div>
 <div class="up"><a href="book.dom.html">DOM</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
